#include "ALLMenu.h"
#include "Show.h"

MainMenu::MainMenu() {
	Name.push_back("Exit");
	Name.push_back("New");
	Name.push_back("Load");
	Name.push_back("Option");
	NextMenu = new IMenu*[item];
	NextMenu[0] = nullptr;
	NextMenu[1] = new PlayMenu01(this);
	NextMenu[2] = new LoadMenu(this);
	NextMenu[3] = new OptionMenu(this);
}

MainMenu::~MainMenu() {
	for(int i = 0; i < item; i++) {
		delete NextMenu[i];
	}
	delete[] NextMenu;
}

std::string MainMenu::GetMyName() {
	return Myname;
}

bool MainMenu::process() {
	int opt = -1;
	while(opt == -1) {
		Show show(this);
		show.Display();
		Choose chs;
		opt = chs.Option(this);
	}
	if(opt == 0) return OVER;
	MenuMgr::getInstance().SetActiveMenu(NextMenu[opt]);
	return !OVER;
}

std::string MainMenu::GetChildName(int k) {
	return Name[k];
}

int MainMenu::GetItem() {
	return item;
}
